package com.only4play.productcenter.api.constans;

import com.only4play.common.constants.BaseEnum;

import java.util.Optional;

public enum InOutStoreType implements BaseEnum<InOutStoreType> {

  IN_INIT(1, "name"),
  IN_RETUREN(2,"退货入库"),
  IN_TRANSFER(3,"调拨入库"),
  OUT_TRANSFER(4,"调拨出库"),
  OUT_RETURN(5,"退货出库"),
  OUT_PRODUCE(6,"生产出库"),
  IN_PRODUCE(7,"生产入库"),
  ;

  InOutStoreType(Integer code, String name) {
    this.code = code;
    this.name = name;
  }

  private Integer code;
  private String name;

  @Override
  public Integer getCode() {
    return this.code;
  }

  @Override
  public String getName() {
    return this.name;
  }

  public static Optional<InOutStoreType> of(Integer code) {
    return Optional.ofNullable(BaseEnum.parseByCode(InOutStoreType.class, code));
  }

}
